<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
  <title></title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <style type="text/css">
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 125%; }
body .hll { background-color: #ffffcc }
body  { background: #f8f8f8; }
body .c { color: #408080; font-style: italic } /* Comment */
body .err { border: 1px solid #FF0000 } /* Error */
body .k { color: #008000; font-weight: bold } /* Keyword */
body .o { color: #666666 } /* Operator */
body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
body .cp { color: #BC7A00 } /* Comment.Preproc */
body .c1 { color: #408080; font-style: italic } /* Comment.Single */
body .cs { color: #408080; font-style: italic } /* Comment.Special */
body .gd { color: #A00000 } /* Generic.Deleted */
body .ge { font-style: italic } /* Generic.Emph */
body .gr { color: #FF0000 } /* Generic.Error */
body .gh { color: #000080; font-weight: bold } /* Generic.Heading */
body .gi { color: #00A000 } /* Generic.Inserted */
body .go { color: #808080 } /* Generic.Output */
body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
body .gs { font-weight: bold } /* Generic.Strong */
body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
body .gt { color: #0040D0 } /* Generic.Traceback */
body .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
body .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
body .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
body .kp { color: #008000 } /* Keyword.Pseudo */
body .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
body .kt { color: #B00040 } /* Keyword.Type */
body .m { color: #666666 } /* Literal.Number */
body .s { color: #BA2121 } /* Literal.String */
body .na { color: #7D9029 } /* Name.Attribute */
body .nb { color: #008000 } /* Name.Builtin */
body .nc { color: #0000FF; font-weight: bold } /* Name.Class */
body .no { color: #880000 } /* Name.Constant */
body .nd { color: #AA22FF } /* Name.Decorator */
body .ni { color: #999999; font-weight: bold } /* Name.Entity */
body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
body .nf { color: #0000FF } /* Name.Function */
body .nl { color: #A0A000 } /* Name.Label */
body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
body .nt { color: #008000; font-weight: bold } /* Name.Tag */
body .nv { color: #19177C } /* Name.Variable */
body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
body .w { color: #bbbbbb } /* Text.Whitespace */
body .mf { color: #666666 } /* Literal.Number.Float */
body .mh { color: #666666 } /* Literal.Number.Hex */
body .mi { color: #666666 } /* Literal.Number.Integer */
body .mo { color: #666666 } /* Literal.Number.Oct */
body .sb { color: #BA2121 } /* Literal.String.Backtick */
body .sc { color: #BA2121 } /* Literal.String.Char */
body .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
body .s2 { color: #BA2121 } /* Literal.String.Double */
body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
body .sh { color: #BA2121 } /* Literal.String.Heredoc */
body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
body .sx { color: #008000 } /* Literal.String.Other */
body .sr { color: #BB6688 } /* Literal.String.Regex */
body .s1 { color: #BA2121 } /* Literal.String.Single */
body .ss { color: #19177C } /* Literal.String.Symbol */
body .bp { color: #008000 } /* Name.Builtin.Pseudo */
body .vc { color: #19177C } /* Name.Variable.Class */
body .vg { color: #19177C } /* Name.Variable.Global */
body .vi { color: #19177C } /* Name.Variable.Instance */
body .il { color: #666666 } /* Literal.Number.Integer.Long */

  </style>
</head>
<body>
<h2></h2>

<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69</pre></div></td><td class="code"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">fbpy.sprite</span>
<span class="kn">import</span> <span class="nn">fbpy.fb</span> <span class="kn">as</span> <span class="nn">fb</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">time</span>

<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span>

    <span class="c">#need it, else sprite will give typerror</span>
    <span class="n">main</span> <span class="o">=</span> <span class="n">fb</span><span class="o">.</span><span class="n">Surface</span><span class="p">()</span>

    <span class="n">timew</span> <span class="o">=</span> <span class="n">fb</span><span class="o">.</span><span class="n">Surface</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),(</span><span class="mi">300</span><span class="p">,</span><span class="mi">10</span><span class="p">))</span>

    <span class="n">sprite</span> <span class="o">=</span> <span class="n">fbpy</span><span class="o">.</span><span class="n">sprite</span><span class="o">.</span><span class="n">Sprite</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),(</span><span class="mi">150</span><span class="p">,</span><span class="mi">157</span><span class="p">))</span>
    <span class="n">sprite</span><span class="o">.</span><span class="n">surface</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span>
    <span class="n">sprite</span><span class="o">.</span><span class="n">surface</span><span class="o">.</span><span class="n">blit</span><span class="p">(</span><span class="s">&quot;./fighter_viper_mk1small.png&quot;</span><span class="p">)</span>
    <span class="n">sprite</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>
    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">160</span><span class="p">):</span>

        <span class="n">sprite</span><span class="o">.</span><span class="n">surface</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span>
        <span class="n">sprite</span><span class="o">.</span><span class="n">surface</span><span class="o">.</span><span class="n">blit</span><span class="p">(</span><span class="s">&quot;./fighter_viper_mk1small.png&quot;</span><span class="p">)</span>
        <span class="n">sprite</span><span class="o">.</span><span class="n">surface</span><span class="o">.</span><span class="n">trafo</span><span class="o">.</span><span class="n">identity</span><span class="p">()</span>
        <span class="n">sprite</span><span class="o">.</span><span class="n">surface</span><span class="o">.</span><span class="n">trafo</span><span class="o">.</span><span class="n">rotate</span><span class="p">(</span><span class="mf">6.28</span><span class="o">/</span><span class="mf">160.0</span><span class="o">*</span><span class="n">i</span><span class="p">)</span>
        <span class="n">sprite</span><span class="o">.</span><span class="n">surface</span><span class="o">.</span><span class="n">styledredraw</span><span class="p">()</span>
        <span class="n">sprite</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>

    <span class="n">main</span><span class="o">.</span><span class="n">keepbackground</span><span class="p">()</span>    
    <span class="n">main</span><span class="o">.</span><span class="n">blit</span><span class="p">(</span><span class="s">&quot;./stars.png&quot;</span><span class="p">)</span>
    <span class="n">main</span><span class="o">.</span><span class="n">update</span><span class="p">()</span>

    <span class="n">tnull</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
    <span class="c">#make it move and debug</span>
    <span class="n">counter</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">nom</span><span class="o">=</span><span class="mi">0</span>
    <span class="c">#for j in range(3):</span>
       <span class="c"># for i in range(0,301,1):</span>
       <span class="c">#     t0 = time.time()</span>

       <span class="c">#     t = i/300.0*2*np.pi</span>
       <span class="c">#     x = -200*np.cos(t)+600</span>
       <span class="c">#     y = 20*np.sin(t)+300</span>
       <span class="c">#     </span>
       <span class="c">#     nom = int(i/300.0*160)</span>
       <span class="c">#     sprite.moveto((x,y), nom)</span>

       <span class="c">#     counter +=1</span>

       <span class="c">#     if not (counter % 50):</span>
       <span class="c">#         timew.clear()</span>
       <span class="c">#         timew.printxy((3,3),&quot;runtime = {0} s&quot;.format(time.time()-tnull),1)</span>
       <span class="c">#         timew.update()</span>

       <span class="c">#     while((time.time()-t0)&lt;0.005):</span>
       <span class="c">#         pass</span>



    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">300</span><span class="p">,</span><span class="o">-</span><span class="mi">300</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">):</span>
       <span class="c"># timew.clear()</span>
       <span class="c"># timew.printxy((3,3),&quot;frame = {0} s&quot;.format(i),1)</span>
       <span class="c"># timew.update()</span>

        <span class="n">sprite</span><span class="o">.</span><span class="n">moveto</span><span class="p">((</span><span class="n">i</span><span class="p">,</span><span class="mi">300</span><span class="p">),</span><span class="mi">1</span><span class="p">)</span>
        <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.01</span><span class="p">)</span>

    <span class="n">sprite</span><span class="o">.</span><span class="n">moveto</span><span class="p">((</span><span class="mi">100</span><span class="p">,</span><span class="mi">100</span><span class="p">),</span><span class="mi">1</span><span class="p">)</span>

    <span class="n">s</span> <span class="o">=</span> <span class="nb">raw_input</span><span class="p">()</span>

    <span class="n">sprite</span><span class="o">.</span><span class="n">hide</span><span class="p">()</span>
</pre></div>
</td></tr></table></body>
</html>
